import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import router from './router'
import store from './store'

router.beforeEach((to,from,next)=>{
  if(to.meta.token ==true){
      if(sessionStorage.getItem('token')){
          next()
      }else{
          router.push('/')
      }
  }else{
      next()
  }
})

// 改造一点
let app = createApp(App)

app.use(store)
app.use(router)
app.use(ElementPlus)
// 放置最后
app.mount('#app')